#!/bin/bash

echo "===============Start packing=================="

function log_i(){
        echo -e "\033[33m [ $1 ] \033[0m"
}

current_path=$(pwd)
log_i "current_path is:$current_path"

path=$current_path/project
if [ ! -d $path ]; then
        mkdir -p $path
        log_i "mkdir project path successful!"
fi
if [ ! -d $path ]; then
        log_i "mdir project path error!"
        exit 0
fi

bin_path=$path/bin
mkdir -p $bin_path
lib_path=$path/lib
mkdir -p $lib_path

cp $current_path/a.out $bin_path
cp $current_path/cal/*.so $lib_path

pack_time=$(date +%Y-%m-%d-%H-%M-%S)
tar zcvf $pack_time.tar.gz project

cat install.sh $pack_time.tar.gz >$pack_time.sh

log_i "==============Finish packing==============="